<template>
  <div class="box">
    <div class="p-tit">
      <div class="p-tit-c">
        <div class="icon">
          <van-icon name="arrow-left" size="20px" color="#ffffff" @click="goback" />
        </div>
        <div class="icon">
          <van-icon name="close" size="20px" color="#ffffff" @click="goback" />
        </div>
      </div>
    </div>
    <div class="box1" ref="box">
      <div class="content">
        <div class="act-t">
          <img :src="arr.avatar" alt="图片找不到了" class="manimg" />
          <p class="act-t-pone">{{arr.name}}</p>
          <p class="act-t-ptwo">{{arr.name_en}}</p>
          <div class="btn">关注</div>
          <p class="act-t-pthree">{{arr.playerId}}人关注</p>
        </div>
        <div class="p-tit-con">
          <p class="p-tit-pone">简介</p>
          <p class="p-tit-ptwo">{{arr.introduce}}</p>
          <div>
            <div class="dots">
              . . .
              <span>查看更多 ></span>
            </div>
          </div>
        </div>
        <div class="show">
          <p class="show-pone">个人作品</p>
          <div class="mov-con">
            <ul class="mov-von-box">
              <li class="mov-li" v-for="(ele,index) in movie" :key="index">
                <div class="mov-img">
                  <img :src="ele.img" class="img1" />
                </div>
                <div class="con-p">
                  <p class="conpone">{{ele.title}}</p>
                  <p class="conptwo">
                    评分
                    <span class="conspan">{{ele.rating_averages}}</span>
                  </p>
                  <p class="conthree">演员 ： {{arr.name}}</p>
                  <p class="conthree">上映时间 : {{ele.year}}</p>
                </div>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import BScroll from "@better-scroll/core";
export default {
  data() {
    return {
      arr: {},
      num: 0,
      movie: []
    };
  },
  computed: {},
  created() {
    console.log(this.$route.params.id);
    this.$axios
      .get("/api/douban/movie/playerInfo", {
        params: {
          playerId: this.$route.params.id
        }
      })
      .then(res => {
        this.arr = res.data;
        this.arr.name = this.arr.name.split(" ")[0];
        this.arr.name_en = this.arr.name_en.split("(")[0];
        this.arr.introduce = this.arr.introduce
          .split("")
          .filter(ele => {
            return ele && ele.trim();
          })
          .join("");
        this.movie = this.arr.movies;
        this.refresh();
        console.log(this.arr);
      });
  },
  mounted() {
    let wrapper = this.$refs.box;
    this.bScroll = new BScroll(wrapper, {
      click: true
    });
  },
  methods: {
    goback() {
      this.$router.go(-1);
    },
    refresh() {
      this.$nextTick(() => {
        this.bScroll.refresh();
      });
    }
  }
};
</script>

<style scoped lang="scss">
.box1 {
  height: 718px;
}
.box {
  background: #22262d;
  overflow: hidden;
}
.p-tit {
  width: 100%;
  height: 60px;
  background: #22262d;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99;
  overflow: hidden;

  .p-tit-c {
    width: 335px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    overflow: hidden;

    .icon {
      margin-top: 20px;
    }
  }
}
.act-t {
  // width: 110px;
  // height: 20px;
  margin: 0 auto;
  margin-top: 93px;
  overflow: hidden;
  .manimg {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    text-align: center;
    margin: 0 auto;
    margin-bottom: 12px;
  }
  .act-t-pone {
    font-size: 20px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: rgba(255, 255, 255, 1);
    line-height: 20px;
    margin: 0 auto;
    margin-bottom: 7px;
  }
  .act-t-ptwo {
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #7f7c79;
    line-height: 12px;
    margin: 0 auto;
    margin-bottom: 10px;
  }
  .btn {
    width: 48px;
    height: 24px;
    background: linear-gradient(
      150deg,
      rgba(242, 91, 134, 1) 0%,
      rgba(241, 172, 94, 1) 100%
    );
    box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.5);
    border-radius: 11px;
    margin: 0 auto;
    font-size: 14px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: rgba(255, 255, 255, 1);
    line-height: 24px;
    margin-bottom: 11px;
  }
  .act-t-pthree {
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #7f7c79;
    line-height: 12px;
    margin: 0 auto;
    margin-bottom: 27px;
  }
}
.p-tit-con {
  width: 335px;
  height: 123px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  margin-bottom: 30px;
  .p-tit-pone {
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
    line-height: 16px;
    text-align: left;
    margin-bottom: 16px;
  }
  .p-tit-ptwo {
    width: 100%;

    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #7f7c79;
    line-height: 18px;
  }
}
.dots {
  position: absolute;
  bottom: 0px;
  right: 0px;
  font-size: 14px;
  line-height: 18px;
  z-index: 99;
  height: 17px;
  width: 102px;
  background: #22262d;
  color: rgba(255, 255, 255, 0.29);
  line-height: 14px;
  text-align: left;
  span {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(251, 195, 74, 1);
    line-height: 14px;
  }
}
.show {
  width: 335px;
  margin: 0 auto;
}
.show-pone {
  font-size: 16px;
  color: rgba(255, 255, 255, 1);
  line-height: 16px;
  text-align: left;
}
.mov-con {
  width: 335px;
  margin: 0 auto;
  overflow: hidden;

  // background-color: red;
  li:nth-child(1) {
    margin-top: 30px;
  }

  .mov-li {
    width: 335px;
    height: 146px;
    background: rgba(51, 54, 61, 1);
    box-shadow: 0px 0px 4px 2px rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    display: flex;
    margin-bottom: 25px;
    position: relative;

    .mov-img {
      width: 119px;
      height: 156px;
      transform: translateY(-10px);
      border-radius: 6px;
      position: relative;
      .img1 {
        height: 100%;
        width: 100%;
        border-radius: 6px;
      }
    }
  }
}
.con-p {
  margin-left: 10px;
  margin-top: 15px;
}
.conpone {
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 1);
  line-height: 16px;
  text-align: left;
}
.conptwo {
  font-size: 14px;
  color: rgba(255, 255, 255, 1);
  line-height: 14px;
  text-align: left;
  margin-top: 15px;
}
.conspan {
  font-size: 14px;
  color: #fbc34a;
  line-height: 14px;
}
.conthree {
  width: 127px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(255, 255, 255, 1);
  line-height: 12px;
  text-align: left;
  margin-top: 15px;
}
</style>
